<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>DataTable Test</title>
    </h:head>
    <h:body>
        <h:form id="form">
			<p:dataTable id="checkboxDT" var="car" value="#{selectionView.cars6}" rows="5"
			rowsPerPageTemplate="5,10,15" 
			paginator="true"
			selection="#{selectionView.selectedCars}" rowKey="#{car.id}" 
			style="margin-bottom:0">
		        <f:facet name="header">
		            Checkbox
		        </f:facet>
		        <!-- 
		        <p:column selectionMode="multiple" style="width:16px;text-align:center" />
		         -->
		         <p:column>
		         		<f:facet name="header">		         				         
				         	<p:selectBooleanCheckbox value="#{selectionView.checkAll}">
					        	<p:ajax event="change" update="checkboxDT" listener="#{selectionView.checkAllListener}" />
					        </p:selectBooleanCheckbox>
						</f:facet>
								<h:selectBooleanCheckbox  value="#{car.status}">
									<p:ajax event="change" update="checkboxDT" />
								</h:selectBooleanCheckbox>			        
		         </p:column>
		         
		        <p:column headerText="Id">
		            <h:outputText value="#{car.id}" />
		        </p:column>
		        <p:column headerText="Year">
		            <h:outputText value="#{car.year}" />
		        </p:column>
		        <p:column headerText="Brand">
		            <h:outputText value="#{car.brand}" />
		        </p:column>
		        <p:column headerText="Color">
		            <h:outputText value="#{car.color}" />
		        </p:column>
    		</p:dataTable>
    		<p:commandButton value="Test" actionListener="#{selectionView.checkAllListener}" update="form"/>   			
    		
        </h:form>
    </h:body>
</html>